package week5;

public class LinearNode {
    private LinearNode next;
    private Product element;

    // 创建空指针
    public LinearNode()
    {
        next = null;
        element = null;
    }

    // 创建指针存储元素
    public LinearNode (Product elem)
    {
        next = null;
        element = elem;
    }

    // 返回下一个指针
    public LinearNode getNext()
    {
        return next;
    }

    // 更改下一个指针
    public void setNext (LinearNode node)
    {
        next = node;
    }

    public double getPrice()
    {
        return element.getPrice();
    }

    // 返回指针中的元素
    public Product getElement()
    {
        return element;
    }

    // 更改指针中的元素
    public void setElement (Product elem)
    {
        element = elem;
    }
}